import java.util.HashMap;
import java.util.Map;

/**
 * Created by Wongy on 2018/4/13.
 */
public class Main2 {
    public static void main(String[] args) {
        Map<Integer, String> map = new HashMap<>();
        for (int i = 0; i < 10; i++) {
            map.putIfAbsent(i, "val" + i);
        }

        map.computeIfPresent(3, (num, val) -> val + num);
        System.out.println(map.get(3));
        map.computeIfPresent(9, (num, val) -> null);
        System.out.println(map.containsKey(9));

        map.computeIfAbsent(23, num -> "val" + num);
        System.out.println(map.containsKey(23));

        map.computeIfAbsent(3, value -> "bam");
        System.out.println(map.get(3));
        System.out.println(map);
    }
}
